package de.stefanocke.roo.wicket.base;

import java.util.Map;

import org.springframework.roo.classpath.PhysicalTypeMetadata;
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails;
import org.springframework.roo.model.JavaType;

import de.stefanocke.roo.wicket.model.JavaTypeMetadataDetails;
import de.stefanocke.roo.wicket.persistence.PersistenceMetadataDetails;

public class ModelClassAwareMetadataCreationParams<AV> implements ModelClassAware, BeanPropertiesClassAware {
	private ItdMetadataCreationParams<AV> commonMetadataCreationParams;

	private JavaTypeMetadataDetails modelClassTypeDetails;

	public ModelClassAwareMetadataCreationParams(ItdMetadataCreationParams<AV> commonMetadataCreationParams,
			JavaTypeMetadataDetails modelClassTypeDetails) {
		super();
		this.commonMetadataCreationParams = commonMetadataCreationParams;
		this.modelClassTypeDetails = modelClassTypeDetails;
	}

	public String getMid() {
		return commonMetadataCreationParams.getMid();
	}

	public JavaType getAspectName() {
		return commonMetadataCreationParams.getAspectName();
	}

	public PhysicalTypeMetadata getGovernorPhysicalTypeMetadata() {
		return commonMetadataCreationParams.getGovernorPhysicalTypeMetadata();
	}

	public AV getAnnotationValues() {
		return commonMetadataCreationParams.getAnnotationValues();
	}

	public Map<String, ClassOrInterfaceTypeDetails> getStereotypes() {
		return commonMetadataCreationParams.getStereotypes();
	}

	public JavaType getModelClass() {
		return modelClassTypeDetails.getJavaType();
	}

	public JavaTypeMetadataDetails getModelClassTypeDetails() {
		return modelClassTypeDetails;
	}

	public ItdMetadataCreationParams<AV> getCommonMetadataCreationParams() {
		return commonMetadataCreationParams;
	}

	@Override
	public JavaType getBeanPropertiesClass() {
		AV av = getAnnotationValues();
		if (av instanceof BeanPropertiesClassAware) {
			return ((BeanPropertiesClassAware) av).getBeanPropertiesClass();
		}
		return null;
	}
//
//	@Override
//	public JavaType[] getModelClasses() {
//		AV av = getAnnotationValues();
//		if(av instanceof ComponentFilterAttributes){
//			return ((ComponentFilterAttributes) av).getModelClasses();
//		}
//		return null;
//	}
//
//	@Override
//	public JavaType[] getRequiredAnnotations() {
//		AV av = getAnnotationValues();
//		if(av instanceof ComponentFilterAttributes){
//			return ((ComponentFilterAttributes) av).getRequiredAnnotations();
//		}
//		return null;
//	}

}
